//
//  ZQLoginModelTools.m
//  jianzhik
//
//  Created by huami on 2018/9/2.
//  Copyright © 2018年 WKWebView. All rights reserved.
//

#import "ZQLoginModelTools.h"

@implementation ZQLoginModelTools

//+ (void)readDataZQModeltoView:(UIView *)view needHud:(BOOL)need searchParameter:(NSString *)name searchBlock:(void (^)(ZQSaveModels *))searchBlock
//{
//    if (need) {
//        [UIHelper showMessage:@"正在加载数据源" toView:view];
//    }
//    NSString *nameStr = [NSString stringWithFormat:@"%%%@%%",name];
//    TODBCondition *condition1 = [TODBCondition condition:@"Username" like:nameStr];
//    
//    
//    [ZQSaveModels search:condition1 callBack:^(NSArray<ZQSaveModels *> *models) {
//        if (models.count == 0) {
//            [UIHelper dismissLoadingInView:view];
//            return searchBlock(nil);
//        }
//        NSLog(@"model d========== == %@",models);
//        searchBlock(models[0]);
//        [UIHelper dismissLoadingInView:view];
//    }];
//}
//
//+ (ZQSaveModels *)readDataZQModeltoView:(UIView *)view needHud:(BOOL)need searchParameter:(NSString *)name
//{
//    __block ZQSaveModels *model;
//    NSBlockOperation *operation1 = [NSBlockOperation blockOperationWithBlock:^{
//        if (need) {
//            dispatch_async(dispatch_get_main_queue(), ^{
//                [UIHelper showMessage:@"正在加载数据源" toView:view];
//            });
//        }
//        TODBCondition *condition1 = [TODBCondition condition:@"Username" like:name];
//        [ZQSaveModels search:condition1 callBack:^(NSArray<ZQSaveModels *> *models) {
//            if (models.count == 0) {
//                model = nil;
//            }
//            model = models[0];
//        }];
//    }];
//    NSBlockOperation *operation2 = [NSBlockOperation blockOperationWithBlock:^{
//        dispatch_async(dispatch_get_main_queue(), ^{
//            [UIHelper dismissLoadingInView:view];
//        });
//    }];
//    //4.设置依赖
//    [operation2 addDependency:operation1];      //任务二依赖任务一
//    //4.设置依赖
//    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
//    [queue addOperations:@[operation2, operation1] waitUntilFinished:YES];
//    return model;
//}
//
//+ (void)saveDataZQModel:(ZQSaveModels *)model toView:(UIView *)view needHud:(BOOL)need saveBlock:(void (^)(void))saveBlock
//{
//    if (need) {
//        [UIHelper showMessage:@"正在保存数据源" toView:view];
//    }
//    [model save:^(NSObject *model) {
//        NSLog(@"存储成功");
//        dispatch_async(dispatch_get_main_queue(), ^{
//            if (need) {
//                [UIHelper dismissLoadingInView:view];
//            }
//            saveBlock();
//        });
//    }];
//}
@end
